//
//  NoJieDanViewController.m
//  Experss
//
//  Created by wmwMAC on 17/8/14.
//  Copyright © 2017年 嗯，大葱. All rights reserved.
//

#import "NoJieDanViewController.h"

#import "DingDanDetailImgTableViewCell.h"
#import "DingDanDetailLocationTableViewCell.h"
#import "DingDanDetailGoodsTableViewCell.h"
#import "DingDanFollowTableViewCell.h"


static NSString *ImgIdentifier = @"DingDanDetailImgTableViewCell";
static NSString *LocationIdentifier = @"DingDanDetailLocationTableViewCell";
static NSString *GoodsIdentifier = @"DingDanDetailGoodsTableViewCell";
static NSString *FollowIdentifier = @"DingDanFollowTableViewCell";
static NSString *FollowContentIdentifier = @"DingDanFollwContentTableViewCell";
@interface NoJieDanViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic, strong) UITableView *tableView;


@end

@implementation NoJieDanViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = BaseColor;
    self.navigationItem.title = @"订单详情";
    
    [self addTableviewUI];
    
    
    
    
}
- (void)addTableviewUI {
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, kScreen_Width, kScreen_Height - NAV_HEIGHT) style:UITableViewStylePlain];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.backgroundColor = BaseColor;
    [self.tableView registerNib:[UINib nibWithNibName:@"DingDanDetailImgTableViewCell" bundle:nil] forCellReuseIdentifier:ImgIdentifier];
    [self.tableView registerNib:[UINib nibWithNibName:@"DingDanDetailLocationTableViewCell" bundle:nil]forCellReuseIdentifier:LocationIdentifier];
    [self.tableView registerClass:[DingDanDetailGoodsTableViewCell class] forCellReuseIdentifier:GoodsIdentifier];
    [self.tableView registerNib:[UINib nibWithNibName:@"DingDanFollowTableViewCell" bundle:nil]forCellReuseIdentifier:FollowIdentifier];
    [self.tableView registerNib:[UINib nibWithNibName:@"DingDanFollwContentTableViewCell" bundle:nil]forCellReuseIdentifier:FollowContentIdentifier];
    
    [self.view addSubview:self.tableView];
    
    
    
   
    
}




-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
        if (indexPath.row == 0) {
            return 80;
        }else if (indexPath.row == 1){
            return 80;
        }else if (indexPath.row == 2){
            return 100;
        }else {
            return  47 + (kScreen_Width - 40 - 30 - 40)/5.0 + 26+6 + 40;
            
        }
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
        return 4;
    
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
    
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
   
        if (indexPath.row == 0) {
            DingDanDetailImgTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ImgIdentifier forIndexPath:indexPath];
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
            
            return cell;
        }else if (indexPath.row == 1){
            DingDanDetailLocationTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:LocationIdentifier forIndexPath:indexPath];
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
            cell.lineImgView.hidden = YES;
            cell.lineView.backgroundColor = [UIColor whiteColor];
            cell.locationImgView.image = [UIImage imageNamed:@"qu"];
            
            return cell;
        }else if (indexPath.row == 2){
            DingDanDetailLocationTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:LocationIdentifier forIndexPath:indexPath];
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
            cell.lineImgView.hidden = NO;
            cell.lineView.backgroundColor = BaseColor;
            cell.locationImgView.image = [UIImage imageNamed:@"song"];
            
            
            return cell;
        }else{
            DingDanDetailGoodsTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:GoodsIdentifier forIndexPath:indexPath];
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
            cell.titleLabel.font = [UIFont systemFontOfSize:14];
            cell.priceLabel.font = [UIFont systemFontOfSize:14];
            
            
            
            return cell;
            
        }
    
    
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    //    if (section == 0) {
    //
    //        return 40;
    //    }else {
    return 0.01;
    //    }
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    UIView *headerView = [[UIView alloc] init];
    headerView.backgroundColor = BaseColor;
    return headerView;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    
    return 100;
    
    
}

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
    UIView *footview = [[UIView alloc] init];
    footview.backgroundColor = BaseColor;
    
    
    UIButton *confirmBtn = [BasePublicCreatUI createBtnFrame:CGRectMake(15, 40, kScreenWidth-30, 50) title:@"立即接单" bgImage:@"bg1" selectBgImage:nil image:nil target:self action:@selector(confirmJiDan)];
    [confirmBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    confirmBtn.titleLabel.font = [UIFont systemFontOfSize:16];
    confirmBtn.layer.cornerRadius = 5;
    confirmBtn.clipsToBounds = YES;
    [footview addSubview:confirmBtn];
    
    return footview;
}
-(void)confirmJiDan{

}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 1) {
        
    }
}




@end
